package com.group3.pojo.result;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.group3.utils.NotNull;
import lombok.Data;

import java.util.Date;

/**
 * @ClassName LeaveRecordResult
 * @Author WenhaoChen
 * @Date 2021/7/10 13:09
 **/
@Data
public class LeaveRecordResult {
    private Integer leaveId;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    private Date startLeaveTime;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    private Date endLeaveTime;

    private String state;

    public void setState(Integer state){
        if(NotNull.judge(state)){
            switch (state){
                case 0 : this.state = "未审批";break;
                case 1 : this.state = "审批未通过";break;
                case 2 : this.state = "审批通过";break;
            }
        }else {
            this.state = "/";
        }

    }

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    private Date submitTime;

    private Integer studentId;

    private String type;

    public void setType(Integer type){
        if(NotNull.judge(type)){
            switch (type){
                case 0 : this.type = "病假";break;
                case 1 : this.type = "事假";break;
                case 2 : this.type = "其他";break;
            }
        }else {
            this.state = "/";
        }
    }

    private String theme;

    private String reason;

    private String reasonsFailure;

}
